package implementation;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.Vector;

import entility.Job;
import entility.JobImpl;
import entility.Machine;
import entility.Notification;

public class DistribuiArquivo{

	List<Integer> numbers;
	String ip;
	
	public DistribuiArquivo(List<Integer> numbers, String ip) {
		super();
		this.numbers = numbers;
		this.ip = ip;
	}

	
	public void run() {
		// TODO Auto-generated method stub
		
		try {
			
			Machine host = new Machine(ip,7000);			
			Job job = new JobImpl(Notification.CLIENT);
			job.setMethod("gravaFile");
			job.setDataInt(numbers);
			Job response = host.getMessage(job);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			/*try {
				sleep(200);
				run();
			} catch (InterruptedException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}*/
			e.printStackTrace();
			
		}
		
		
		
		
		
	}

}
